import type { UserType } from "@/type/user"
import { defineStore } from "pinia"
import { ref } from "vue"

export const useUserStore = defineStore(
  "user",
  () => {
    const user = ref<UserType>({} as UserType)

    const setUser = (obj:UserType) => {
        // 将数据推入pinia已经声明的响应式
        user.value = obj
    }
    // 导出数据 导出存数据的方法
    return { user ,setUser}
  },
  { unistorage: true } // 全部数据持久化
)
